<template>
  <div class="list">
    <Header></Header>
    <div class="pageList">
      <div class="count">
        <span class="number">
          <a href="javascript:history.back(-1);" class="return">
            <span>
              <img
                src="../../assets/images/return2.png"
                width="15px"
                height="20px"
              /> </span
            >返回首页
          </a>
          |&nbsp;&nbsp;{{ searchValue }}&nbsp;&nbsp;&nbsp;<span
            style="font-size: 18px; color: #f7f7f8"
            >{{ total }}&nbsp;</span
          >件
        </span>
      </div>
      <Pages :allDate="data" :pageSize="pageSize" :total="total"></Pages>
    </div>
    <Footer></Footer>
    <toTop></toTop>
  </div>
</template>
  
  <script>
import toTop from "@/components/toTop.vue";
import Pages from "@/components/Pages.vue";
import Header from "@/components/head.vue";
import Footer from "@/components/footer.vue";
import { mapState, mapMutations } from "vuex";
import { Search } from "@/api/all";
export default {
  components: {
    Pages,
    Header,
    toTop,
    Footer,
  },
  data() {
    return {
      data: [],
      total: 0, //总条数
      pageSize: 30, //每页多少条
      searchValue: "",
    };
  },
  created() {
    this.searchValue = this.$route.query.searchValue;
    this.search();
  },
  mounted() {
    this.$bus.$on("searchRelic", (searchValue) => {
      this.searchValue = searchValue;
      this.search();
    });
  },
  methods: {
    async search() {
      let params = {
        searchValue: this.searchValue,
      };
      await Search(params)
        .then((res) => {
          if (res.data.code == 200) {
            this.data = res.data.data.relicList;
            this.total = this.data.length;
            // window.location.reload();
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>
  
  <style scoped>
.list {
  width: 100%;
  background: #5f806f;
  /* overflow: auto; 启用滚动 */
}
.pageList {
  min-height: 90vh;
}
.count {
  font-size: 25px;
  background: #5f806f;
  display: flex;
  height: 70px;
  width: 100%;
  border-bottom: 1px solid #fff;
  margin-top: 20px;
  justify-content: space-between;
  align-content: space-between;
}
.number {
  color: #f2f3f4;
  font-size: 20px;
  padding-left: 20px;
  margin-top: 15px;
}
.vue-waterfall-column {
  width: 294px !important;
}
.return {
  color: #f2f3f4;
}
a {
  margin-right: 10px;
}
a span {
  vertical-align: middle;
}
</style>